import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShootingTaskVO, ShootingTaskForm, ShootingTaskQuery } from '@/api/system/shootingTask/types';

/**
 * 查询隐患排查任务列表
 * @param query
 * @returns {*}
 */

export const listShootingTask = (query?: ShootingTaskQuery): AxiosPromise<ShootingTaskVO[]> => {
  return request({
    url: '/system/shootingTask/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询隐患排查任务详细
 * @param id
 */
export const getShootingTask = (id: string | number): AxiosPromise<ShootingTaskVO> => {
  return request({
    url: '/system/shootingTask/' + id,
    method: 'get'
  });
};

/**
 * 新增隐患排查任务
 * @param data
 */
export const addShootingTask = (data: ShootingTaskForm) => {
  return request({
    url: '/system/shootingTask',
    method: 'post',
    data: data
  });
};

/**
 * 修改隐患排查任务
 * @param data
 */
export const updateShootingTask = (data: ShootingTaskForm) => {
  return request({
    url: '/system/shootingTask',
    method: 'put',
    data: data
  });
};

/**
 * 删除隐患排查任务
 * @param id
 */
export const delShootingTask = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/shootingTask/' + id,
    method: 'delete'
  });
};
